package com.syqc.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.syqc.entity.LocationStatus
import com.syqc.login.LocationStatusModel
import com.syqc.monitor.R

/**
 *@Author pc_hfjs
 *@Date 2022/1/14 16:26
 *@Desc
 */
class CarInfoAdapter :
    BaseQuickAdapter<LocationStatus, BaseViewHolder>(R.layout.item_info_car) {
    override fun convert(holder: BaseViewHolder, item: LocationStatus) {
        if (item.name.isNotEmpty()) {
            holder.setText(R.id.tvInfoTitle, item.name).setText(R.id.tvInfoValue, item.value)
        } else {
            holder.setText(
                R.id.tvInfoTitle,
                context.getString(LocationStatusModel.getDescByKey(item.key))
            ).setText(R.id.tvInfoValue, item.value)
        }

    }
}